common/memory: Fix ABI breakage for XENMEM_add_to_physmap
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 20 Jan 2014 08:49:20 +0000 (09:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 20 Jan 2014 08:49:20 +0000 (09:49 +0100)
commitebc168f238ab7a729c45032c9663b14844f34656
tree92aa6b4cbfcdc64e3ec2d493bde7f1de11e70301
parentefd8ff0a04740a698b2b8b2b9adccd639e0fa6c9
common/memory: Fix ABI breakage for XENMEM_add_to_physmap

caused by c/s 4be86bb194e25e46b6cbee900601bfee76e8090a

In public/memory.h, struct xen_add_to_physmap has 'space' as an unsigned int,
but struct xen_add_to_physmap_batch has 'space' as a uint16_t.

By defining xenmem_add_to_physmap_one() with space defined as uint16_t, the
now-common xenmem_add_to_physmap() implicitly truncates xatp->space from
unsigned int to uint16_t, which changes the space switch()'d upon.

This wouldn't be noticed with any upstream code (of which I am aware), but was
discovered because of the XenServer support for legacy Windows PV drivers,
which make XENMEM_add_to_physmap hypercalls using spaces with the top bit set.
The current Windows PV drivers don't do this any more, but we 'fix' Xen to
support running VMs with out-of-date tools.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Ack: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/arm/mm.c
xen/arch/x86/mm.c
xen/include/xen/mm.h